package com.innoking.docsys.user.controller;

import com.innoking.docsys.user.module.TbUser;
import com.innoking.docsys.utils.JsonToOtherUtil;
import com.innoking.docsys.utils.OtherPojo;
import com.innoking.docsys.utils.ResultObjVO;
import com.innoking.docsys.utils.ResultUtil;
import org.springframework.web.bind.annotation.*;

/**
 * Created by Administrator on 2019/8/15.
 */
@RestController
@RequestMapping("/")
public class UserController {

    @PostMapping("/home")
    public ResultObjVO home(@RequestBody String data) {
        System.out.println("Hello home");
        OtherPojo ob = JsonToOtherUtil.rtOtherPojo(data, new TbUser() );
        TbUser tbUserVo= (TbUser) ob.getObj();
       // System.out.println(data);
        TbUser tbUser=new TbUser();
        tbUser.setAvatarUrl("111111");
        tbUser.setCity("xian");
        tbUser.setNickname(tbUserVo.getNickname());
        tbUser.setWechatOpenid(tbUserVo.getWechatOpenid());
        return ResultUtil.success( tbUser );
    }
    @GetMapping("/test")
    public ResultObjVO test(@RequestParam("data") String data) {
        System.out.println("Hello test");
       // System.out.println(data);
        TbUser tbUser=new TbUser();
        tbUser.setAvatarUrl("111111");
        tbUser.setCity("xian");
        return ResultUtil.success( tbUser );
    }
}